import gtk

class ui():
    

    def __init__(self,widget):
        self.w = widget
        self.lat = gtk.Label("none")
        self.lng = gtk.Label("none")
        self.cell = gtk.Label("none")
        self.wifi = gtk.Label("none")
        self.color = True

    def draw(self):
        hbox0 = gtk.HBox(False, 0)

        llat = gtk.Label(" lat:")
        llng = gtk.Label(" lng:")
        lcell = gtk.Label("cell:")
        lwifi = gtk.Label("wifi:")

        vbox1 = gtk.VBox(False, 0)

        vbox1.pack_start(llat, False, False, 0)
        vbox1.pack_start(llng, False, False, 0)
        vbox1.pack_start(lcell, False, False, 0)
        vbox1.pack_start(lwifi, False, False, 0)
        vbox1.show_all()

        hbox0.pack_start(vbox1, True, True, 0)

        vbox12 = gtk.VBox(False, 0)
        vbox12.pack_start(self.lat, False, False, 0)
        vbox12.pack_start(self.lng, False, False, 0)
        vbox12.pack_start(self.cell, False, False, 0)
        vbox12.pack_start(self.wifi, False, False, 0)
        vbox12.show_all()

        hbox0.pack_start(vbox12, True, True, 0)
        hbox0.show_all()

        self.w.add(hbox0)
    
        #self.w.connect("clicked", self.test)

    def blue(self,ctl):
        ctl.set_markup('<span color="blue">'+ctl.get_text()+'</span>')
    def red(self,ctl):
        ctl.set_markup('<span color="red">'+ctl.get_text()+'</span>')

    def green(self,ctl):
        ctl.set_markup('<span color="green">'+ctl.get_text()+'</span>')


    def set_lat(self,v):
        self.lat.set_text(str(v))
        if self.color == True:
            self.red(self.lat)
            #self.color = False
        else:
            self.green(self.lat)
            #self.color = True

    def set_lng(self,v):
        self.lng.set_text(str(v))
        if self.color == True:
            self.red(self.lng)
            #self.color = False
        else:
            self.green(self.lng)
            #self.color = True

    def set_cell(self,v):
        self.cell.set_text(str(v))
        if self.color == True:
            self.red(self.cell)
            #self.color = False
        else:
            self.green(self.cell)
            #self.color = True

    def set_wifi(self,v):
        self.wifi.set_text(str(v))
        if self.color == True:
            self.red(self.wifi)
            self.color = False
        else:
            self.green(self.wifi)
            self.color = True

